﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Models;
using System.Data;
using System.Data.SqlClient;


namespace DAL
{
    public class ShoppingDAL
    {
        public static DataTable Select()
        {
            string sql = "select top 6 Img,Shoppingming,Jiezhishijian from dbo.Shopping order by Jiezhishijian";
            return DBHelper.Instance().GetDataTableBySql(sql);
        }
        public static DataTable Chapaihang()
        {
            string sql = "select top 1 Img,Shoppingming,Price,Renqizhi,Suoxurenci,Suoxurenci-Renqizhi Syrc from dbo.Shopping order by Renqizhi desc";
            return DBHelper.Instance().GetDataTableBySql(sql);
        }
        public static DataTable Chapaihanger()
        {
            string sql = "select top 8 Img,Shoppingming,Suoxurenci-Renqizhi Syrc from dbo.Shopping where Renqizhi  < (select MAX(Renqizhi) from dbo.Shopping) order by Renqizhi desc";
            return DBHelper.Instance().GetDataTableBySql(sql);
        }
    }
}